<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="previous" href="Base64.html">
<link rel="next" href="Dllist.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of class methods" rel=Appendix href="index_methods.html">
<link title="Index of classes" rel=Appendix href="index_classes.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Base64" rel="Chapter" href="Base64.html">
<link title="BitSet" rel="Chapter" href="BitSet.html">
<link title="Dllist" rel="Chapter" href="Dllist.html">
<link title="DynArray" rel="Chapter" href="DynArray.html">
<link title="Enum" rel="Chapter" href="Enum.html">
<link title="ExtArray" rel="Chapter" href="ExtArray.html">
<link title="ExtHashtbl" rel="Chapter" href="ExtHashtbl.html">
<link title="ExtLib" rel="Chapter" href="ExtLib.html">
<link title="ExtList" rel="Chapter" href="ExtList.html">
<link title="ExtString" rel="Chapter" href="ExtString.html">
<link title="Global" rel="Chapter" href="Global.html">
<link title="IO" rel="Chapter" href="IO.html">
<link title="OptParse" rel="Chapter" href="OptParse.html">
<link title="Option" rel="Chapter" href="Option.html">
<link title="PMap" rel="Chapter" href="PMap.html">
<link title="RefList" rel="Chapter" href="RefList.html">
<link title="Std" rel="Chapter" href="Std.html">
<link title="UChar" rel="Chapter" href="UChar.html">
<link title="UTF8" rel="Chapter" href="UTF8.html">
<link title="Unzip" rel="Chapter" href="Unzip.html"><title>BitSet</title>
</head>
<body>
<div class="navbar"><a class="pre" href="Base64.html" title="Base64">Previous</a>
&nbsp;<a class="up" href="index.html" title="Index">Up</a>
&nbsp;<a class="post" href="Dllist.html" title="Dllist">Next</a>
</div>
<h1>Module <a href="type_BitSet.html">BitSet</a></h1>
<pre><span class="keyword">module</span> BitSet: <code class="code">sig</code> <a href="BitSet.html">..</a> <code class="code">end</code></pre><div class="info">
Efficient bit sets.
<p>

 A bitset is an array of boolean values that can be accessed with indexes
 like an array but provides a better memory usage (divided by 8) for a
 very small speed trade-off.<br>
</div>
<hr width="100%">
<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type"></code>t</span> </pre>

<pre><span id="EXCEPTIONNegative_index"><span class="keyword">exception</span> Negative_index</span> <span class="keyword">of</span> <code class="type">string</code></pre>
<div class="info">
When a negative bit value is used for one of the BitSet functions,
 this exception is raised with the name of the function.<br>
</div>
<pre><span id="VALempty"><span class="keyword">val</span> empty</span> : <code class="type">unit -> <a href="BitSet.html#TYPEt">t</a></code></pre><div class="info">
Create an empty bitset of size 0, the bitset will automatically expand
 when needed.<br>
</div>
<pre><span id="VALcreate"><span class="keyword">val</span> create</span> : <code class="type">int -> <a href="BitSet.html#TYPEt">t</a></code></pre><div class="info">
Create an empty bitset with an initial size (in number of bits).<br>
</div>
<pre><span id="VALcopy"><span class="keyword">val</span> copy</span> : <code class="type"><a href="BitSet.html#TYPEt">t</a> -> <a href="BitSet.html#TYPEt">t</a></code></pre><div class="info">
Copy a bitset : further modifications of first one will not affect the
 copy.<br>
</div>
<pre><span id="VALclone"><span class="keyword">val</span> clone</span> : <code class="type"><a href="BitSet.html#TYPEt">t</a> -> <a href="BitSet.html#TYPEt">t</a></code></pre><div class="info">
Same as <code class="code">copy</code><br>
</div>
<pre><span id="VALset"><span class="keyword">val</span> set</span> : <code class="type"><a href="BitSet.html#TYPEt">t</a> -> int -> unit</code></pre><div class="info">
<code class="code">set s n</code> sets the nth-bit in the bitset <code class="code">s</code> to true.<br>
</div>
<pre><span id="VALunset"><span class="keyword">val</span> unset</span> : <code class="type"><a href="BitSet.html#TYPEt">t</a> -> int -> unit</code></pre><div class="info">
<code class="code">unset s n</code> sets the nth-bit in the bitset <code class="code">s</code> to false.<br>
</div>
<pre><span id="VALput"><span class="keyword">val</span> put</span> : <code class="type"><a href="BitSet.html#TYPEt">t</a> -> bool -> int -> unit</code></pre><div class="info">
<code class="code">put s v n</code> sets the nth-bit in the bitset <code class="code">s</code> to <code class="code">v</code>.<br>
</div>
<pre><span id="VALtoggle"><span class="keyword">val</span> toggle</span> : <code class="type"><a href="BitSet.html#TYPEt">t</a> -> int -> unit</code></pre><div class="info">
<code class="code">toggle s n</code> changes the nth-bit value in the bitset <code class="code">s</code>.<br>
</div>
<pre><span id="VALis_set"><span class="keyword">val</span> is_set</span> : <code class="type"><a href="BitSet.html#TYPEt">t</a> -> int -> bool</code></pre><div class="info">
<code class="code">is_set s n</code> returns true if nth-bit in the bitset <code class="code">s</code> is set,
 or false otherwise.<br>
</div>
<pre><span id="VALcompare"><span class="keyword">val</span> compare</span> : <code class="type"><a href="BitSet.html#TYPEt">t</a> -> <a href="BitSet.html#TYPEt">t</a> -> int</code></pre><div class="info">
<code class="code">compare s1 s2</code> compares two bitsets. Highest bit indexes are
 compared first.<br>
</div>
<pre><span id="VALequals"><span class="keyword">val</span> equals</span> : <code class="type"><a href="BitSet.html#TYPEt">t</a> -> <a href="BitSet.html#TYPEt">t</a> -> bool</code></pre><div class="info">
<code class="code">equals s1 s2</code> returns true if, and only if, all bits values in s1 are
  the same as in s2.<br>
</div>
<pre><span id="VALcount"><span class="keyword">val</span> count</span> : <code class="type"><a href="BitSet.html#TYPEt">t</a> -> int</code></pre><div class="info">
<code class="code">count s</code> returns the number of bits set in the bitset <code class="code">s</code>.<br>
</div>
<pre><span id="VALenum"><span class="keyword">val</span> enum</span> : <code class="type"><a href="BitSet.html#TYPEt">t</a> -> int <a href="Enum.html#TYPEt">Enum.t</a></code></pre><div class="info">
<code class="code">enum s</code> returns an enumeration of bits which are set
  in the bitset <code class="code">s</code>.<br>
</div>
<pre><span id="VALintersect"><span class="keyword">val</span> intersect</span> : <code class="type"><a href="BitSet.html#TYPEt">t</a> -> <a href="BitSet.html#TYPEt">t</a> -> unit</code></pre><div class="info">
<code class="code">intersect s t</code> sets <code class="code">s</code> to the intersection of the sets <code class="code">s</code> and <code class="code">t</code>.<br>
</div>
<pre><span id="VALunite"><span class="keyword">val</span> unite</span> : <code class="type"><a href="BitSet.html#TYPEt">t</a> -> <a href="BitSet.html#TYPEt">t</a> -> unit</code></pre><div class="info">
<code class="code">unite s t</code> sets <code class="code">s</code> to the union of the sets <code class="code">s</code> and <code class="code">t</code>.<br>
</div>
<pre><span id="VALdifferentiate"><span class="keyword">val</span> differentiate</span> : <code class="type"><a href="BitSet.html#TYPEt">t</a> -> <a href="BitSet.html#TYPEt">t</a> -> unit</code></pre><div class="info">
<code class="code">differentiate s t</code> removes the elements of <code class="code">t</code> from <code class="code">s</code>.<br>
</div>
<pre><span id="VALdifferentiate_sym"><span class="keyword">val</span> differentiate_sym</span> : <code class="type"><a href="BitSet.html#TYPEt">t</a> -> <a href="BitSet.html#TYPEt">t</a> -> unit</code></pre><div class="info">
<code class="code">differentiate_sym s t</code> sets <code class="code">s</code> to the symmetrical difference of the
  sets <code class="code">s</code> and <code class="code">t</code>.<br>
</div>
<pre><span id="VALinter"><span class="keyword">val</span> inter</span> : <code class="type"><a href="BitSet.html#TYPEt">t</a> -> <a href="BitSet.html#TYPEt">t</a> -> <a href="BitSet.html#TYPEt">t</a></code></pre><div class="info">
<code class="code">inter s t</code> returns the intersection of sets <code class="code">s</code> and <code class="code">t</code>.<br>
</div>
<pre><span id="VALunion"><span class="keyword">val</span> union</span> : <code class="type"><a href="BitSet.html#TYPEt">t</a> -> <a href="BitSet.html#TYPEt">t</a> -> <a href="BitSet.html#TYPEt">t</a></code></pre><div class="info">
<code class="code">union s t</code> return the union of sets <code class="code">s</code>  and <code class="code">t</code>.<br>
</div>
<pre><span id="VALdiff"><span class="keyword">val</span> diff</span> : <code class="type"><a href="BitSet.html#TYPEt">t</a> -> <a href="BitSet.html#TYPEt">t</a> -> <a href="BitSet.html#TYPEt">t</a></code></pre><div class="info">
<code class="code">diff s t</code> returns <code class="code">s</code>-<code class="code">t</code>.<br>
</div>
<pre><span id="VALsym_diff"><span class="keyword">val</span> sym_diff</span> : <code class="type"><a href="BitSet.html#TYPEt">t</a> -> <a href="BitSet.html#TYPEt">t</a> -> <a href="BitSet.html#TYPEt">t</a></code></pre><div class="info">
<code class="code">sym_diff s t</code> returns the symmetrical difference of <code class="code">s</code> and <code class="code">t</code>.<br>
</div>
</body></html>